package com.wswy.wyjk.ui.login.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

public class LoginResponse implements android.os.Parcelable{
    @SerializedName("username")
    public String userName;
    @SerializedName("nickname")
    public String nickName;
    @SerializedName(value = "isSetPwd",alternate = {"isSetPass"})
    public boolean isSetPwd;
    @SerializedName("mobile")
    public String mobile;
    @SerializedName("headImg")
    public String headImg;
    @SerializedName("alias")
    public String userAlias="default";
    @SerializedName("token")
    public String token;
    @SerializedName("wechatBind")
    public boolean wechatBind = false;

    public String getHeadImg() {
        return headImg==null?"":headImg;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.userName);
        dest.writeString(this.nickName);
        dest.writeByte(this.isSetPwd ? (byte) 1 : (byte) 0);
        dest.writeString(this.mobile);
        dest.writeString(this.headImg);
        dest.writeString(this.userAlias);
        dest.writeString(this.token);
        dest.writeByte(this.wechatBind ? (byte) 1 : (byte) 0);
    }

    public LoginResponse() {
    }

    protected LoginResponse(Parcel in) {
        this.userName = in.readString();
        this.nickName = in.readString();
        this.isSetPwd = in.readByte() != 0;
        this.mobile = in.readString();
        this.headImg = in.readString();
        this.userAlias = in.readString();
        this.token = in.readString();
        this.wechatBind = in.readByte() != 0;
    }

    public static final Parcelable.Creator<LoginResponse> CREATOR = new Parcelable.Creator<LoginResponse>() {
        @Override
        public LoginResponse createFromParcel(Parcel source) {
            return new LoginResponse(source);
        }

        @Override
        public LoginResponse[] newArray(int size) {
            return new LoginResponse[size];
        }
    };
}
